import request from '@/utils/request'

// 查询卫星遥控列表
export function listControl(query) {
  return request({
    url: '/kamenxians1/control/list',
    method: 'get',
    params: query
  })
}

// 查询卫星遥控详细
export function getControl(id) {
  return request({
    url: '/kamenxians1/control/' + id,
    method: 'get'
  })
}

// 新增卫星遥控
export function addControl(data) {
  return request({
    url: '/kamenxians1/control',
    method: 'post',
    data: data
  })
}

// 修改卫星遥控
export function updateControl(data) {
  return request({
    url: '/kamenxians1/control',
    method: 'put',
    data: data
  })
}

// 删除卫星遥控
export function delControl(id) {
  return request({
    url: '/kamenxians1/control/' + id,
    method: 'delete'
  })
}

export function upload(data){
  return request({
    url: '/kamenxians1/control/import',
    method: 'post',
    data: data,
    headers: {
      'Content-Type': 'multipart/form-data'
    },
    timeout: 0 // 设置超时时间为 0 表示不限制请求时间
  })
}

/* === 导出 === */
export function exportExcelSp1stSatelliteRemoteControl(data) {
  return request({ url: '/kamenxians1/control/exportExcel', method: 'post', data, responseType: 'blob' })
}
export function exportPdfSp1stSatelliteRemoteControl(data) {
  return request({ url: '/kamenxians1/control/exportPdf', method: 'post', data, responseType: 'blob' })
}
export function exportWordSp1stSatelliteRemoteControl(data) {
  return request({ url: '/kamenxians1/control/exportWord', method: 'post', data, responseType: 'blob' })
}

/* === 导入 === */
export function importDataSp1stSatelliteRemoteControl(data) {
  return request({ url: '/kamenxians1/control/importData', method: 'post', data, headers: { 'Content-Type': 'multipart/form-data' } })
}
export function importTemplateSp1stSatelliteRemoteControl() {
  return request({ url: '/kamenxians1/control/importTemplate', method: 'post', responseType: 'blob' })
}
